import os

def move_path(source_path, target_path):
    # 获取当前目录下的所有文件名和子目录名
    entries = os.listdir(source_path)

    # 遍历所有文件和子目录
    for entry in entries:
        # 构建完整路径
        full_path = os.path.join(source_path, entry)

        if os.path.isdir(full_path):
            # 如果是子目录，递归处理子目录
            move_path(full_path, target_path)
        else:
            # 如果是文件，则移动到目标目录下
            try:
                os.rename(full_path, os.path.join(target_path, entry))
            except:
                pass


def main():
    source_path = input("请输入 source 目录的路径：")
    target_path = input("请输入 target 目录的路径：")
    move_path(source_path, target_path)


if __name__ == "__main__":
    main()
